import Taro, { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import { AtButton } from 'taro-ui'
import './inquiryList.css'
import app from '../../../main.js'

export default class InquiryList extends Component {

    config = {
        navigationBarTitleText: '问卷列表'
    }

    constructor () {
        super(...arguments)
        this.state = {
            inquiryList:[
                {
                    id:1,
                    name:'问卷1',
                    compete:'未完成'
                },{
                    id:2,
                    name:'问卷2',
                    compete:'完成'
                }
            ]
        }
    }

    inquiry(){
        app.navigateTo('../inquiry/inquiry')
    }

    componentWillMount () {
    
    }

    componentDidMount () {}

    componentWillUnmount () { }

    componentDidShow () { }

    componentDidHide () { }

    render () {
        return (
        <View className='inquiryList'>
            {
                this.state.inquiryList.map((item,index)=>
                    <View className='inquiry'>
                        <View>{item.name}</View>
                        {
                            item.compete == '完成'
                            ?
                            <AtButton type='primary' size='small' circle='true' disabled='true'>已完成</AtButton>
                            :
                            <AtButton type='primary' size='small' circle='true' onClick={this.inquiry.bind(this)}>未完成</AtButton>
                        }
                    </View>
                )
            }
        </View>
        )
    }
}

